<%-- 
    Document   : mahram_tambah
    Created on : Oct 30, 2013, 2:57:09 PM
    Author     : hasnor
--%>
<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<%@page contentType="text/html" pageEncoding="windows-1252"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Tambah Mahram</title>
        <script type="text/javascript">
            $(document).ready(function(){
                $('form').submit( function () {
                    return formValidation();
                }); 
            });
            function resetAll(){
                document.getElementById("noAkaunMahram").value = "";
                document.getElementById("noKpMahram").value = "";
                document.getElementById("pertalianMahram").value = "";
            }
            function validate(){
                
                var hubungan=document.getElementById("pertalianMahram");
                var noKp = document.getElementById("noKpMahram");
                
                if(document.getElementById("noAkaunMahram").value.length != 15){
                    alert("Masukkan nombor akaun yang betul");
                    return false;                   
                } 
//                else if(!hubungan_validate(hubungan)) {
//                    return false;
//                }
                else if (!noKp_validate(noKp)) {
                    return false;
                }
                else{
                    return true;                    
                }
            }
//            function validate1(f){
//                if(validate()){
//                    f.action = "${pageContext.request.contextPath}/haji/response?HajjResp_Step2";
//                    f.submit();
//                }
            function validate1(f){
           if(validate()){
                 f.action = "${pageContext.request.contextPath}/haji/response?checkMahram";
               f.submit();
           }
            }
            
             function goBack()
            {
                window.history.back();
            }
            
//            function hubungan_validate(hubungan)
//            {
//                if(hubungan.value=="")
//                {
//                        alert("Sila masukkan Pertalian");
//                        return false; 
//                }
//                else                    
//                    return true;
//            }
            
             function noKp_validate(noKp)
            {
                if(noKp.value=="")
                {
                        alert("Sila masukkan No KP Semasa Mahram");
                        return false; 
                }
                else                    
                    return true;
            }
    </script>
    </head>
    <body>
        <s:messages/>
        <s:errors/> 
        <br/>
        <s:useActionBean beanclass="th.stripes.util.ListUtil" id="listUtil" />
        <s:form beanclass="th.stripes.action.HajiResponseActionBean" class="niceform">
             <s:hidden name="haji.noDaftar" id="noDaftar"/>
            <s:hidden name="haji.nama" id="nama"/>
            <s:hidden name="haji.noAkaun" id="noAkaun"/>
            <s:hidden name="haji.alamat1" id="alamat1"/>
            <s:hidden name="haji.alamat2" id="alamat2"/>
            <s:hidden name="haji.poskod" id="poskod"/>
            <s:hidden name="haji.poskodDeskripsi" id="poskodDeskripsi"/>
            <s:hidden name="haji.tahunTawaran" id="tahunTawaran"/>
            <s:hidden name="haji.tahunTawaranHijrah" id="tahunTawaranHijrah"/>
            <div id="content">
                <div id="logo">
                    <span>
                        <img src="${pageContext.request.contextPath}/images/img/ribbon.png"/>               
                    </span>
                </div>
                <h3>
                    Tambah Mahram
                </h3>
                
                <p>
                  Wanita berumur 44 tahun dan ke bawah wajib menamakan MAHRAM yang akan pergi bersama-sama ke Tanah Suci. 
                  Sila isikan maklumat mahram tuan/puan di bawah. 
                </p>
                <p>
                    <label>No. Akaun TH</label> : 
                        <s:text name="haji.noAkaunMahram" id="noAkaunMahram"/> 
                </p>
                <p>
                    <label>No. KP Semasa</label> : 
                     <s:text name="haji.noKpMahram" id="noKpMahram" readonly="false"/> 
                </p>     
               <p>
                    <label>Pertalian :</label>
                     <s:select name="haji.hbgnMahram.kod" id="pertalianMahram">
                     <s:option value="">Sila Pilih</s:option>
                     <c:forEach items="${listUtil.senaraiHubunganMahram}" var="item">
                            <s:option value="${item.kod}">${item.kod} - ${item.nama}</s:option>
                     </c:forEach>
                     </s:select> 
                  
                </p> 
                <p align="center">
                    <s:button name="HajjResp_step3" value="Semak" class="button green" onclick="validate1(this.form)"/>
                    <s:button name="reset" value="Isi Semula" onclick="resetAll();" class="button green"/>
                    <s:submit name="HajjResp_Step4" value="Kembali" class="button green"></s:submit>&nbsp
                </p>
            </div>
        </s:form>
    </body>
</html>
